﻿
Public Class ThreadManager


    Private Shared ReadOnly m_instance = New ThreadManager
    Private T_ReadLock As Queue = New Queue
    Private T_WriteLock As Queue = New Queue

    Public Shared Function getInstance()
        Return m_instance
    End Function

    'ReadLock数を記憶する
    Public Sub setReadLock()
        T_ReadLock.Enqueue("1")
    End Sub

    'ReadLock数を渡す
    Public Function getReadLock()
        Return T_ReadLock.Count
    End Function

    'ReadLock数を記憶する
    Public Sub setWriteLock()
        T_WriteLock.Enqueue("1")
    End Sub

    'ReadLock数を渡す
    Public Function getWriteLock()
        Return T_WriteLock.Count
    End Function

    'ReadLock削除
    Public Sub delReadLock()
        If Not T_ReadLock.Count = 0 Then
            T_ReadLock.Dequeue()
        End If
    End Sub

    'WriteLock削除
    Public Sub delWriteLock()
        If Not T_WriteLock.Count = 0 Then
            T_WriteLock.Dequeue()
        End If
    End Sub

End Class
